home *** CD-ROM | disk | FTP | other *** search
- int statica;
-
- static test_debordement(a)
- int *a;
- {
- int i;
- ++(short*)a;
- i=a[0];
- }
-
- static test(p)
- int *p;
- {
- int z = *p;
- }
-
- static freeall(a)
- int *a;
- {
- free(a);
- }
-
- static proc_fin()
- {
- int *b;
- b = (long*)4;
- *b = *(long*)4;
- AP_Close();
- }
-
- main()
- {
- int *a,*b;
- int c;
- extern int *malloc();
- AP_Init();
- a=malloc(4),malloc(400),malloc(12000);
- if(a)
- {
- if(b=malloc(15)) {a[0]=b[-10];c=b[0];free(b);}
- a[1] = 0;
- test(&c);b=&c;*b=0;
- b = &statica;
- *b = 15;
- test_debordement(a);
- freeall(a);
- proc_fin();
- test_debordement(a);
- }
- return 0;
- }
-